<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ page
	import="com.onlineMIS.common.Common_util,java.util.Date,java.text.SimpleDateFormat"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>千禧宝贝连锁店管理信息系统</title>
<%@ include file="../../common/Style.jsp"%>
<link href="<%=request.getContextPath()%>/conf_files/css/pagination.css"
	rel="stylesheet" type="text/css" />
<SCRIPT src="<%=request.getContextPath()%>/conf_files/js/pagenav1.1.js"
	type=text/javascript></SCRIPT>
<script>
$(document).ready(function(){
	parent.$.messager.progress('close'); 
	$("#billType").combobox('setValue',null);
	
	var params = $.serializeObject($('#financeBillSearchForm')); 
	
	dataGrid =  $('#customerDataGrid').datagrid({
		url : 'financeHQJSON!searchFHQBill',
		queryParams: params,
		fit : true,
		fitColumns : true,
		pagination : true,
		pageSize : 15,
		pageList : [ 15, 30],

		checkOnSelect : false,
		selectOnCheck : false,
		singleSelect:true,
		showFooter:true,
		rownumbers:true,
		nowrap : false,
		sortName : '',
		sortOrder : 'asc',
		rowStyler: function(index,row){
			var style = "";
			if (row.status == 1)
				style += 'color:blue;';
			else if (row.status == 3)
				style += 'color:red;';				
			return style;
		},
		columns : [ [
				    {field:'id', width:3,title:'编号',sortable:true,order:'desc'},
					{field:'custName', width:8,title:'客户'},
					{field:'typeHQS', width:5,title:'单据种类'},
					{field:'creatorHqName', width:5,title:'创建人'},
					{field:'billDate', width:5,title:'单据日期'},
					{field:'createDate', width:5,title:'创建日期',sortable:true,
						order:'desc'},
					{field:'updateDate', width:5,title:'更新日期',sortable:true,
						order:'desc'},
					{field:'invoiceTotal', width:5,title:'金额',
						sortable:true,
						order:'desc',
						formatter: function (value, row, index){
							return row.invoiceTotal;
						}
						},
					{field:'statusS', width:5,title:'状态'},
					{field:'comment', width:10,title:'备注'},
					{
						field:'details', 
						width:5,
						title:'详情',
						align: 'center',
						formatter : function(value, row, index) {
							var str = '';
							var url = "financeHQJSP!getFHQ?formBean.financeBill.id=" + row.id;
							var nodeTitle = "财务单据"+ row.id;
							if (row.id != 0){							  					
								 str += $.formatString('<a href="javascript:addTab3(\'{0}\',\'{1}\');"><img border="0" src="{2}" title="详情"/></a>',url,nodeTitle,'<%=request.getContextPath()%>/conf_files/easyUI/themes/icons/update.png');							
							}
							return str;
						}
					}
			     ]],
		toolbar : '#customerToolbar'
	
	});
});
function searchBills(){
	var params = $.serializeObject($('#financeBillSearchForm')); 
	$('#customerDataGrid').datagrid('load',params); 
}
function downloadFQHBillExcel(){
	document.financeBillSearchForm.action="financeHQJSP!downloadFHQBill";
	document.financeBillSearchForm.submit();
}

function changeChainStore(chainId){

}

</script>
</head>
<body>
<div class="easyui-layout" data-options="fit : true,border : false">
	<div data-options="region:'north',border:false" style="height: 130px;">
	<s:form id="financeBillSearchForm" name="financeBillSearchForm"
		action="/actionChain/inventoryFlowAction!searchInvenOrder"
		theme="simple" method="POST">
		<input type="hidden" id="isAll" name="formBean.isAll" value="1" />
		<input type="hidden" id="indicator" name="formBean.indicator"
			value="0" />
		<table width="98%" align="center" class="OuterTable">
			<tr>
				<td>
					<table width="100%" border="0">
						<tr>
							<td height="50" colspan="7">
								<div class="errorAndmes">
									<s:actionerror cssStyle="color:red" />
									<s:actionmessage cssStyle="color:blue" />
								</div>
								<table width="100%" border="0">
									<tr class="PBAOuterTableTitale">
										<td height="35" colspan="6">搜索客户财务单据
										</td>
									</tr>
									<tr class="InnerTableContent">
										
										<td width="22%"><%@ include file="../custMgmt/CustInput.jsp"%>										
										<td width="20%"><strong>单据日期 ：</strong> <s:textfield id="startDate"
												name="formBean.searchStartTime" cssClass="easyui-datebox"
												data-options="width:100,editable:false" />-												
										<s:textfield id="endDate"
												name="formBean.searchEndTime" cssClass="easyui-datebox"
												data-options="width:100,editable:false" />																			
										</td>
										<td width="15%"><strong>单据状态：    </strong><s:select name="formBean.financeBill.status" cssClass="easyui-combobox" style="width:140px;text-align: center"
												list="formBean.financeBill.statusMap" listKey="key"
												listValue="value" headerKey="" headerValue=""  data-options="prompt:'请选择单据状态!'"/></td>
										<td ><strong>单据种类：  </strong><s:select name="formBean.financeBill.type"  id="billType"
												list="formBean.financeBill.typeHQMap" listKey="key" cssClass="easyui-combobox" style="width:140px;text-align: center"
												listValue="value" headerKey="" headerValue="" data-options="prompt:'请选择单据种类!'"/></td>
									</tr>
									<tr class="InnerTableContent">
									
							 	</td>
						    </tr>		
						  </table>
					 </td>
			    </tr>
			   
			  </table>
	   </td></tr>
	 </table>
	 </s:form>
	 
	 </div>
	
		<div data-options="region:'center',border:false">
			<table id="customerDataGrid">
			</table>
		</div>
	</div>
		
	<div id="customerToolbar" style="display: none;">
		<s:if test="#session.LOGIN_USER.containFunction('financeHQJSON!searchFHQBill')"> 
				<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="searchBills();">搜索单据</a>
		 </s:if>
		<!-- financeBillTask -->
		<s:if test="#session.LOGIN_USER.containFunction('financeHQJSON!searchFHQBill')"> 
				<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print',plain:true" onclick="downloadFQHBillExcel();">下载单据</a>
		 </s:if>
	</div>

</body>
</html>